<template>
  <div class="background-white">
    <div class="update-info">
      <div class="margin-16">
        <el-input
          placeholder="项目标题"
          v-model="editObj.projectName"
          clearable>
        </el-input>
      </div>
      <div class="margin-16">
        <el-input
          placeholder="作者"
          v-model="editObj.author"
          clearable>
        </el-input>
      </div>
      <div class="margin-16">
        <editor></editor>
      </div>
      <div class="margin-16">
        <el-row>
          <el-col :span="2">
            <span class="first-left"><span style="color: #cc0000"> *</span>封面：</span>
          </el-col>
          <el-col :span="7">
            <upload :limit="1" :errorTitle="'只能上传1张简介照片'"></upload>
          </el-col>
        </el-row>
      </div>

    </div>
    <div>
      <div style="padding-top: 16px;padding-bottom: 16px">
        <el-row>
          <el-col :span="6" :offset="3">
            <el-button type="danger" size="mini">保存</el-button>
            <el-button size="mini" v-if="isEdit">删除</el-button>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
  import editor from "~/components/editor";
  import upload from "~/components/uploadImg";

  export default {
    name: "update",
    components: {
      editor,
      upload
    },
    props: {
      isEdit: {
        type: Boolean,
        default: false
      },
      isAdd: {
        type: Boolean,
        default: false
      },
      editObj: {
        type: Object,
        default: () => {
          return {};
        }
      },
    },
    data() {
      return {}
    },
    methods: {
      deleteRow(id) {
        this.$emit('deleteRow', {id: id})
      },
    }
  }
</script>

<style scoped lang="scss">
  .margin-16 {
    margin-bottom: 16px;
  }
</style>
